{include file='public/head'}
<body>
<style type="text/css" media="screen">
    header {
        color: black;
    }

    .info td {
        padding: 0 0
    }

    .layui-table {
        margin: 0 0
    }

    .layui-this {
        background-color: #5FB878
    }

    .layui-tab {
        margin: 0 0
    }

    .layui-tab-content {
        padding: 0 0
    }

    #right {
        width: 100%;
        position: absolute;
        top: 0;
        height: 100%;
    }

    .layui-card-header {
        height: auto
    }

    .x-body {
        min-width: 1000px;
    }

    body {
        overflow-x: scroll;
    }
</style>
<div class="x-body">
    <input type="hidden" id="company_id" name="company_id" value="{$Think.get.company_id}">
    <table class="layui-table info">
        <tbody>
        <tr>
            <td colspan="3" style="width: 45%">
                <div class="layui-card">
                    <div class="layui-card-header"><b>订单信息</b></div>
                    <div class="layui-card-body">
                        买家姓名：{$order.user_name}<br>
                        订单编号：{$order.order_no}<br>
                        电话号码：{$order.receiver_phone}<br>
                        买家邮箱：{$order.receiver_email}<br>
                        邮&nbsp;&nbsp;&nbsp;&nbsp;编：{$order.receiver_zip}<br>
                        收货地址：{$order.receive_nation},{$order.receiver_province},{$order.receiver_city}，{$order.receiver_district}，{$order.receiver_address}&nbsp;&nbsp;&nbsp;&nbsp;{$order.receiver_name}<br>
                        备注信息：{$order.buyer_message}
                    </div>
                </div>
            </td>
            <td colspan="5">
                <div class="layui-card" id="right">
                    <div class="layui-card-header">
                        订单状态：{$order_status[$order['order_status']]}
                        <button onclick="p_admin_show('运单信息','waybill.html?id={$order.id}&company_id={$order.company_id}')"
                                class="layui-btn layui-btn-xs">运单信息
                        </button>
                    </div>
                    <div class="layui-card-body">
                        亚马逊手续费：{$order.fee}{$order.coin}
                    </div>
                </div>
            </td>
        </tr>
        </tbody>
    </table>
    <table class="layui-table">
        <thead>
        <tr>
            <td style="width: 85px;text-align:center">商品图</td>
            <td>商品标题</td>
            <td style="width: 75px;text-align: center">成本</td>
            <td style="width: 75px;text-align: center">购买数量</td>
            <td style="width: 75px;text-align: center">总价</td>
            <td style="width: 75px;text-align: center">找货单</td>
            <td style="width: 75px;text-align: center">状态</td>
        </tr>
        </thead>
        <tbody>
        {volist name="orderGoods" id="vo"}
        <tr>
            <td style="text-align: center">
                {if $vo['url']}
                <img src="{$vo.url}" onclick="previewImg(this)">
                {elseif empty($vo['imgpath'])}
                <img src="__images__/noimg.png">
                {else/}
                <img src="{$vo['imgpath']}" onclick="previewImg(this)">
                {/if}
            </td>
            <td>
                <a href="{$store.org}/dp/{$vo.asin}" style="color: #01AAED;" target="_blank">{$vo.goods_name}</a>
            </td>
            <td style="text-align: center">{$vo.cost_price}CNY</td>
            <td style="text-align: center">{$vo.num}</td>
            <td style="text-align: center">{$vo.goods_money}{$vo.coin}</td>
            <td style="text-align: center">
                {if $vo['find_goods_id']}
                <a href="javascript:;"
                   onclick="p_admin_show('找货详情','{:url(\'admin/purchase/info\')}?id={$vo.find_goods_id}')"
                   style="color: #01AAED;text-decoration:underline;cursor:hand">查看详情</a>
                {/if}
            </td>
            <td style="text-align: center">{$order_status[$vo['good_status']]}</td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">内部备注</li>
            <li>操作日志</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <table class="layui-table">
                    <colgroup>
                        <col width="50">
                        <col width="250">
                    </colgroup>
                    <tbody>
                    {if empty($Think.get.company_id)}
                    <tr>
                        <td colspan="2">
                            <button class="layui-btn" onclick="addRemark('{$order.id}')">添加备注</button>
                        </td>
                    </tr>
                    {/if}
                    {if count($orderRemarks)>0}
                    {volist name="orderRemarks" id="vo"}
                    <tr>
                        <td>{$vo.truename}<br>{$vo['timestamp']|date="Y-m-d H:i",###}</td>
                        <td>{$vo.remark}</td>
                    </tr>
                    {/volist}
                    {else/}
                    <tr>
                        <td colspan="2">暂时没有备注信息</td>
                    </tr>
                    {/if}
                    </tbody>
                </table>
            </div>

            <div class="layui-tab-item">
                <table class="layui-table">
                    <colgroup>
                        <col width="50">
                        <col width="250">
                    </colgroup>
                    <tbody>
                    {if count($orderAction)>0}
                    {volist name="orderAction" id="vo"}
                    <tr>
                        <td>{$vo.truename}<br>{$vo['action_time']|date="Y-m-d H:i",###}</td>
                        <td>{$vo.action}</td>
                    </tr>
                    {/volist}
                    {else/}
                    <tr>
                        <td colspan="2">暂时没有操作信息</td>
                    </tr>
                    {/if}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</body>
{include file='public/foot'}
<script type="text/javascript">
    var layer = layui.layer;

    function addRemark(id) {
        layer.prompt({title: '添加备注信息', formType: 2}, function (text, index) {
            layer.close(index);
            $.ajax({
                url: "addRemark",
                async: true,
                dataType: 'json',
                data: {remark: text, order_id: id, isall: 1},
                type: "post",
                success: function (data) {
                    if (data.code == 0) {
                        layer.msg(data.msg);
                    } else {
                        layer.msg(data.msg, {icon: 1, time: 500}, function () {
                            location.reload();
                        });
                    }
                }
            })
        });
    }

</script>
